import { getById } from '@/modules/user/model/user'

const result = {
  state: {
    result: ''
  },

  mutations: {
    SET_RESULT: (state, result) => {
      state.result = result
    }

  },

  actions: {
    // 登录
    LoadById({ commit }, id) {
      return new Promise((resolve, reject) => {
        getById(id).then(response => {
          const data = response.data.item
          commit('SET_RESULT', data)
          resolve()
        }).catch(error => {
          reject(error)
        })
      })
    }

  }
}

export default result
